package com.patrol.inspection.config;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ESConfig {
    @Value("${spring.elasticsearch.rest.uris}")
    private String uri;
    @Bean
    public RestHighLevelClient restHighLevelClient(){
        System.out.println(uri);
        return new RestHighLevelClient(RestClient.builder(
//                HttpHost.create("http://192.168.226.133:9200")
                HttpHost.create(uri)
        ));
    }
}
